package test;

import java.util.regex.Pattern;

/**
 * TODO
 *
 * @author david
 * @version 1.0
 * @date 2023/3/1516:16
 */
public class test {

    public static void main(String[] args) {
//        *PROGRAM_TRAINING_+*+$yyyyMMdd+*
        String expressionValue =".*?.*?20230823.*?";
        String fileName ="DIM_BUSINESS_ORGANIZATION_PARTNER_PROGRAM_TRAINING_20230823054624";
        String x=getExpressionValue(expressionValue);
        System.out.println(Pattern.matches(x, fileName));
    }
    public static String getExpressionValue(String dataResult) {
        //获取每一段内容
        String[] list = dataResult.split(String.valueOf('+'));
        StringBuffer stringBuffer = new StringBuffer();
        for (String one : list) {
            //如果为$开头
            if (one.startsWith("$")) {
                String substring = one.substring(1);

                stringBuffer.append("20230823");
            }
            if (one.startsWith("#")) {
                stringBuffer.append(one.substring(1));
            }
            if (one.startsWith("*")) {
                stringBuffer.append(".*?");
            }
        }
        return stringBuffer.toString();
    }

}
